<!DOCTYPE html>
<%@page import="com.doeis.manage.bean.Page"%>
<%@page import="com.doeis.manage.bean.Catalog"%>
<%@page import="java.util.List"%>
<%@page import="com.doeis.common.Constant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	Boolean isMe = (Boolean)request.getAttribute("isMe");
	List<Catalog> catalogs = (List<Catalog>)request.getAttribute("catalogs");
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%=Constant.LOTTERY_PROJECT_TITLE%></title>
<%@include file="/WEB-INF/page/common/import.jsp"%>

<link rel="stylesheet" href="/static/css/item/show.css" />
</head>
<body>
	<div class="doc-head row">
		<div class="left ">
			<h2>${item.item_name}</h2>
		</div>
		<div class="right">
			<ul class="inline pull-right">
				<%if(isMe){ %>
				<li>
					<div class="btn-group ">
						<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"> 项目 <span class="caret"></span>
						</a>
						<ul class="dropdown-menu">
							<!-- dropdown menu links -->
							<%-- <li><a href="#" id="share">分享</a></li>
							<li><a href="/item/word?item_id=${item.id}">导出</a></li> --%>
							<li><a href="/item/add?item_id=${item.id}">修改信息</a></li>
							<%-- <li><a href="/member/edit?item_id=${item.id}">成员管理</a></li>
							<li><a href="/attorn/index?item_id=${item.id}">转让</a></li> --%>
							<li><a href="/item/delete?item_id=${item.id}">删除</a></li>
							<li><a href="/item/index">更多项目</a></li>
							<li><a href="/index">网站首页</a></li>
						</ul>
					</div>
				</li>
				<%}else if(user==null){ %>
					<li><a href="/user/login">登录/注册</a></li>
					<li><a href="/item/show?item_id=3" target="_blank">关于ShowDoc</a></li>
				<%}else{ %>
					<li><a href="/item/index">我的项目</a></li>
				<%}%>

			</ul>
		</div>
	</div>

	<div class="doc-body row">
		<!-- 左侧栏菜单 -->
		<div class="doc-left span3 bs-docs-sidebar pull-left">
			<form class="form-search text-center" action="" method="get">
				<div class="input-append search-input-append">
					<i class="icon-blank"></i> <input type="text" name="keyword" class="search-query search-query-input"
						value="${param.keyword}"> <input type="hidden" name="item_id" value="${item.id}">
					<button type="submit" class="btn">
						<i class="icon-search"></i>
					</button>
				</div>
			</form>

			<ul class="nav nav-list bs-docs-sidenav">
				<%if(catalogs!=null){ 
					List<Page> pages = null;
					for(Catalog cat:catalogs){
						pages = cat.getPages();
				%>
					<li><a href="#"><i class="icon-chevron-right"></i><%=cat.getCat_name() %></a>
					<%if(catalogs!=null&&catalogs.size()>0){
					%>
						<ul class="child-ul nav-list hide">
					<%
						for(Page p:pages){
					%>
						<li><a href="/page/index?page_id=<%=p.getId() %>" data-page-id="<%=p.getId() %>"><%=p.getPage_title() %></a></li>
					<%} %>
						</ul>
					<%} %>
					</li>
				<%}} %>


			</ul>
			<!-- 新建栏 -->
			<div class="doc-left-newbar">

				<%if(isMe){ %>
				<div>
					<a href="/page/edit?item_id=${item.id}&type=new" id="new-like"><i class="icon-plus"></i>&nbsp;新建页面</a>
				</div>
				<div>
					<a href="/catalog/edit?item_id=${item.id}" id="dir-like"><i class="icon-folder-open"></i>新建目录</a>
				</div>
				<%} %>

			</div>

			<input type="hidden" id="item_id" value="${item.id}"> 
			<input type="hidden" id="page_id" value="${page_id}"> 
			<input type="hidden" id="base_url" value="">
		</div>
		
		<div class="doc-right span12 ">
			<!-- 编辑栏 -->
			<div class='page-edit-link pull-right hide'>
				<ul class="inline">
					<%if(isMe){ %>
					<li><a href="" id="share-page" title="分享该接口访问地址给你的好友">分享</a></li>
					<li><a href="" id="copy-link" title="复制该接口到新接口">复制</a></li>
					<li><a href="" id="edit-link" title="编辑接口">编辑</a></li>
					<li><a href="javascript:void(0)" title="删除接口" id="delete-link">删除</a></li>
					<%}else{ %>
					<li></li>
					<li></li>
					<%} %>
				</ul>
			</div>
			<!-- 页面内容 -->
			<div class='iframe_content'>
				<iframe id="page-content" width="100%" scrolling="yes" height="100%" frameborder="0"
					style="overflow: visible; height: 100%;" name="main" seamless="seamless" src=""></iframe>
			</div>
		
		</div>
	</div>

<!-- 分享项目框 -->
<div class="modal hide fade" id="share-modal">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3>分享</h3>
	</div>
	<div class="modal-body">
		<p>
			项目地址：
			<code>${share_url}</code>
		</p>
		<p>你可以复制地址给你的好友</p>
	</div>
</div>

<!-- 分享页面框 -->
<div class="modal hide fade" id="share-page-modal">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3>分享页面</h3>
	</div>
	<div class="modal-body">
		<p>
			页面地址：
			<code id="share-page-link"></code>
		</p>
		<p>你可以复制地址给你的好友</p>
	</div>
</div>
<script src="/static/js/jquery.bootstrap-growl.min.js"></script>
<script src="/static/js/jquery.hotkeys.js"></script>

<script src="/static/js/item/show.js"></script>
</body>
</html>